package sevensoft.行为型模式.迭代器模式;

import java.util.ArrayList;
import java.util.List;

public class MyAggregateImpl<T> implements MyAggregate<T> {

    List<T> list = new ArrayList<>();

    @Override
    public void add(T t) {
        list.add(t);
    }

    @Override
    public void remove(T t) {
        list.remove(t);
    }

    @Override
    public MyIterator<T> getIterator() {
        return new MyIteratorImpl<>(list);
    }
}
